//
//  ALPEditorDetailCell.m
//  AlpFM
//
//  Created by dllo on 16/1/28.
//  Copyright © 2016年 Alp. All rights reserved.
//

#import "ALPEditorDetailCell.h"

@interface ALPEditorDetailCell ()
@property (nonatomic, strong) UIImageView *myImage;
@property (nonatomic, strong) UILabel *titleLabel;
@property (nonatomic, strong) UILabel *describeLabel;
@property (nonatomic, strong) UILabel *timesLabel;
@property (nonatomic, strong) UILabel *jishu; //集数
@property (nonatomic, strong) UIImageView *baisanjiao;
@property (nonatomic, strong) UIImageView *jishuImage;
@property (nonatomic, strong) UIImageView *shoucang;
@property (nonatomic, strong) UILabel *shoucangLable;



@end

@implementation ALPEditorDetailCell


-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self creat];
    }
    return self;
}
// 10  83  93
-(void)creat{
    self.myImage = [[UIImageView alloc]initWithFrame:CGRectMake(10, 10, 68, 68)];
    [self.contentView addSubview:self.myImage];
    
    self.titleLabel = [[UILabel alloc]initWithFrame:CGRectMake(87, 10, 230, 20)];
    [self.contentView addSubview:self.titleLabel];
    
    self.describeLabel = [[UILabel alloc]initWithFrame:CGRectMake(87, 40, 230, 15)];
    self.describeLabel.font = [UIFont boldSystemFontOfSize:15];
    self.describeLabel.textColor = [UIColor grayColor];
    [self.contentView addSubview:self.describeLabel];
    
    self.baisanjiao = [[UIImageView alloc]initWithFrame:CGRectMake(87, 60, 10, 10)];
    self.baisanjiao.image = [UIImage imageNamed:@"baisanjiao"];
    [self.contentView addSubview:self.baisanjiao];
    
    self.timesLabel = [[UILabel alloc]initWithFrame:CGRectMake(102, 60, 58, 10)];
    self.timesLabel.font = [UIFont boldSystemFontOfSize:13];
    self.timesLabel.textColor = [UIColor grayColor];
    [self.contentView addSubview:self.timesLabel];
    
    self.jishuImage = [[UIImageView alloc]initWithFrame:CGRectMake(165, 60, 10, 10)];
    self.jishuImage.image = [UIImage imageNamed:@"shuxian"];
    [self.contentView addSubview:self.jishuImage];
    
    self.jishu = [[UILabel alloc]initWithFrame:CGRectMake(180, 60, 100, 10)];
    self.jishu.font = [UIFont boldSystemFontOfSize:13];
    self.jishu.textColor = [UIColor grayColor];
    [self.contentView addSubview:self.jishu];
    
    self.shoucang = [[UIImageView alloc]initWithFrame:CGRectMake(330, 20, 30, 27)];
    self.shoucang.image = [UIImage imageNamed:@"shoucangno"];
    [self.contentView addSubview:self.shoucang];
    
    self.shoucangLable = [[UILabel alloc]initWithFrame:CGRectMake(330, 47, 30, 20)];
    self.shoucangLable.text = @"收藏";
    self.shoucangLable.font = [UIFont boldSystemFontOfSize:14];
    self.shoucangLable.textColor = [UIColor redColor];
    [self.contentView addSubview:self.shoucangLable];
    
}


-(void)setMol:(ALPEditorDetailModel *)mol{
    _mol = mol;
    [self.myImage sd_setImageWithURL:[NSURL URLWithString:_mol.coverMiddle] placeholderImage:nil];
    self.titleLabel.text = _mol.title;
    self.describeLabel.text = _mol.intro;
    NSInteger time =  _mol.playsCounts / 1000 -  _mol.playsCounts / 10000 * 10;
    NSInteger time1 = _mol.playsCounts / 10000;
    NSString *str = [NSString stringWithFormat:@"%ld",time];
    NSString *str1 = [NSString stringWithFormat:@"%ld",time1];
    NSString *str2 = [str1 stringByAppendingString:@"."];
    NSString *str3 = [str2 stringByAppendingString:str];
    NSString *str4 = [str3 stringByAppendingString:@"万"];
    self.timesLabel.text = str4;
    
    NSString *str5 = [NSString stringWithFormat:@"%ld",_mol.tracksCounts];
    NSString *str6 = [str5 stringByAppendingString:@"集"];
    self.jishu.text = str6;
    
}
















- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
